<template>
	<el-dialog width="80%" top="1vh" title="查看风控大数据" :visible.sync="dialogVisible" :close-on-click-modal="false">
		<h2>{{initData.cert_name}}风控大数据报告</h2>
		<br>
		<el-row>
			<el-col :span="8">报告生成时间：{{initData.start_at}}</el-col>
			<el-col :span="8">有效期至：{{initData.end_at}}</el-col>
			<el-col :span="8">订单ID：{{initData.orderId}}</el-col>
		</el-row>
		<br>
		<el-descriptions title="基本数据" direction="vertical" :column="5" border>
			<el-descriptions-item label="姓名">{{initData.cert_name}}</el-descriptions-item>
			<el-descriptions-item label="性别">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.base_info.gender :''}}
			</el-descriptions-item>
			<el-descriptions-item label="年龄">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.base_info.age :''}}
			</el-descriptions-item>
			<el-descriptions-item label="手机号码">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.base_info.phone :''}}
			</el-descriptions-item>
			<el-descriptions-item label="手机号码归属地">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.base_info.phone_address :''}}
			</el-descriptions-item>
			<el-descriptions-item label="身份证号码" :span="2">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.base_info.ident_number :''}}
			</el-descriptions-item>
			<el-descriptions-item label="身份证号地址">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.base_info.ident_number_address :''}}
			</el-descriptions-item>
			<el-descriptions-item label="手机号与本人是否一致">
				{{Object.keys(this.initData.resp_data).length ? initData.is_me :''}}</el-descriptions-item>
			<el-descriptions-item label="手机在网时长">
				{{Object.keys(this.initData.resp_data).length ? initData.online_time :''}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="风险名单检测" direction="vertical" :column="5" border>
			<el-descriptions-item label="归属地位于高风险集中地区"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.census_register_high_risk_area==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.census_register_high_risk_area==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="车辆租赁违约名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_clzlwy==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_clzlwy==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="法院结案名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fyja==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fyja==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="法院失信名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fysx==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fysx==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="法院执行名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fyzx==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fyzx==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="犯罪通缉名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fztj==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_fztj==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="高风险关注名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_gfxgz==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_gfxgz==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="故意违章乘车名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_gywzcc==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_gywzcc==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="欠税名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_qs==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_qs==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="欠税公司法人代表名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_qsgsfrdb==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_qsgsfrdb==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="信贷逾期名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_xdyq==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_xdyq==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="助学贷款欠费历史"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_zxdkqf==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.idcard_hit_zxdkqf==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="通信小号库"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.phone_hit_txxh==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.phone_hit_txxh==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="虚假号码库"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.phone_hit_xjhm==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.phone_hit_xjhm==1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="特殊关注名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.result_xd==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.risk_list_check.result_xd==1?'命中':'未命中'}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="近期贷款需求" direction="vertical" :column="7" border>
			<el-descriptions-item label="一般消费分期平台">
				&nbsp;&nbsp;7天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.d7_apply_setup_time_ybxffq : ''}}
				<br> <br>
				30天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m1_apply_setup_time_ybxffq : ''}}
				<br> <br>
				90天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m3_apply_setup_time_ybxffq : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="信用卡">
				&nbsp;&nbsp;7天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.d7_apply_setup_time_xyk : ''}}
				<br> <br>
				30天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m1_apply_setup_time_xyk : ''}}
				<br> <br>
				90天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m3_apply_setup_time_xyk : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="大型消费金融公司">
				&nbsp;&nbsp;7天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.d7_apply_setup_time_dxxfjr : ''}}
				<br> <br>
				30天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m1_apply_setup_time_dxxfjr : ''}}
				<br> <br>
				90天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m3_apply_setup_time_dxxfjr : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="其它类型公司">
				&nbsp;&nbsp;7天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.d7_apply_setup_time_other : ''}}
				<br> <br>
				30天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m1_apply_setup_time_other : ''}}
				<br> <br>
				90天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m3_apply_setup_time_other : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="P2P平台">
				&nbsp;&nbsp;7天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.d7_apply_setup_time_p2pwd : ''}}
				<br> <br>
				30天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m1_apply_setup_time_p2pwd : ''}}
				<br> <br>
				90天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m3_apply_setup_time_p2pwd : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="小额贷款公司">
				&nbsp;&nbsp;7天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.d7_apply_setup_time_xedkgs : ''}}
				<br> <br>
				30天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m1_apply_setup_time_xedkgs : ''}}
				<br> <br>
				90天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m3_apply_setup_time_xedkgs : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="申请查询总数">
				&nbsp;&nbsp;7天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.d7_apply_setup_time : ''}}
				<br> <br>
				30天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m1_apply_setup_time : ''}}
				<br> <br>
				90天：{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_demand.m3_apply_setup_time : ''}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="贷款放款信息" direction="vertical" :column="5" border>
			<el-descriptions-item label="消费分期类放款机构数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.cflenders : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="最近一次距今天数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.lend_time_distance : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近1个月放款次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.lend_number1 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近3个月放款次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.lend_number3 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近6个月放款次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.lend_number6 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="最近一次放款时间">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.lend_time : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近12个月放款机构总数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.lenders : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="贷款时长">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.loanday : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="网络贷款类放款机构数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.nllenders : ''}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="履约情况" direction="vertical" :column="2" border>
			<el-descriptions-item label="近1个月还款异常次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.repay_fail1 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近12个月还款异常次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.repay_fail12 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近1个月履约次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.repay_succ1 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近12个月履约次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_f.repay_succ12 : ''}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="贷款申请信息" direction="vertical" :column="3" border>
			<el-descriptions-item label="近12个月申请机构总数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.apply_mechanism_number : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近1个月申请次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.apply_time1 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近3个月申请次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.apply_time3 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近6个月申请次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.apply_time6 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近12个月申请次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.apply_time12 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="消费分期类申请机构数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.consumer_apply_mechanism_number : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="距离最近一次申请日期的天数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.last_apply_time_distance : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="最近一次申请日期">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.last_apply_time : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="网络贷款类申请机构数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_loan_s.network_loan_apply_mechanis_mnumber : ''}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="历史逾期记录" direction="vertical" :column="4" border>
			<el-descriptions-item label="近6个月逾期总次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_overdue_history.counts : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近6个月逾期机构总数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_overdue_history.overdue_mechanism_number : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近6个月逾期总金额（元）">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_overdue_history.overdue_money : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近6个月逾期未结清次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.personal_overdue_history.uncleared_counts : ''}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<h4>历史逾期详情</h4>
		<br>
		<el-table :data="personal_overdue_history_list" border :highlight-current-row="true" style="width: 100%">
			<el-table-column prop="overdue_day" label="逾期天数" width="180">
			</el-table-column>
			<el-table-column prop="overdue_money" label="逾期金额" width="180">
			</el-table-column>
			<el-table-column prop="overdue_time" label="逾期时间">
			</el-table-column>
			<el-table-column prop="settlement" label="是否结清">
			</el-table-column>
		</el-table>
		<br>
		<p class="red">逾期天数 : (S:单期
			M:多期)S/M表示逾期的期数。S代表现⾦贷的期数，1期=7天，S0表示不到7天、S1代表7-14天，以此类推；M代表消费分期的期数，1期=30天，M0表示不到30天，M1代表30-60天，以此类推。</p>
		<br>
		<el-descriptions title="历史租赁印记" direction="vertical" :column="4" border>
			<el-descriptions-item label="是否命中租赁黑名单"
				:contentClassName="Object.keys(this.initData.resp_data).length && initData.resp_data.rent_history.rent_history_black==1?'red':'green'">
				{{Object.keys(this.initData.resp_data).length && initData.resp_data.rent_history.rent_history_black == 1?'命中':'未命中'}}
			</el-descriptions-item>
			<el-descriptions-item label="历史申请最高风险分数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.rent_history.rent_history_max_grade : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近7天申请租赁次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.rent_history.rent_history_times_d7 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近1个月申请租赁次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.rent_history.rent_history_times_m1 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近3个月申请租赁次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.rent_history.rent_history_times_m3 : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="近6个月申请租赁次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.rent_history.rent_history_times_m6 : ''}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<p class="red">历史申请最高风险分数 : 0-100分，分数越高风险越高</p>
		<br>
		<el-descriptions title="关联风险检测" direction="vertical" :column="2" border>
			<el-descriptions-item label="3个月身份证关联手机号次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.relevance_risk_check.m3_idcard_to_phone_time : ''}}
			</el-descriptions-item>
			<el-descriptions-item label="3个月手机号关联身份证次数">
				{{Object.keys(this.initData.resp_data).length ? initData.resp_data.relevance_risk_check.m3_phone_to_idcard_time : ''}}
			</el-descriptions-item>
		</el-descriptions>
		<br>
		<el-descriptions title="命中风险标记" direction="vertical" :column="3" border>
			<el-descriptions-item label="风险点" v-for="value in this.hit_risk_tagging">{{value}}</el-descriptions-item>
		</el-descriptions>
		<br>
		<h4>法院风险信息</h4>
		<br>
		<el-table :data="court_risk_info_list" border :highlight-current-row="true" style="width: 100%">
			<el-table-column prop="sort_time_string" label="审结日期" width="180">
			</el-table-column>
			<el-table-column prop="data_type" label="类型" width="180">
			</el-table-column>
			<el-table-column prop="summary" label="摘要说明">
			</el-table-column>
			<el-table-column prop="compatibility" label="匹配度">
			</el-table-column>
		</el-table>
		<br>
		<p class="red">类型："cpws": "裁判文书";"ktgg": "开庭公告";"ajlc": "案件流程信息";"fygg": "法院公告";"shixin": "失信公告";"zxgg":
			"执行公告";"bgt": "曝光台";</p>
		<br>
		<p class="red">匹配度 :
			匹配度是一个概率（范围为0~1），匹配度为0，则完全不匹配；匹配度为1，则完全匹配。通常，匹配度达到0.8及以上，相似度已经很高，基本上可以确定是这个人；匹配度在0.5及以下，说明可以关联到部分信息，但是相似度较低，大概率不是这个人；匹配度在0.5-0.8时，需根据用户的风控策略，做取舍。
		</p>
		<br>
	</el-dialog>
</template>

<script>
	import {
		getRiskData
	} from "@/api/order";
	export default {
		props: ['editItem'],
		data() {
			return {
				form: {
					orderId: '',
					cert_name: '', //真实姓名
					cert_no: '', //身份证号
					mobile: '', //手机号
					rent_total:'',
					goods_type:'',
					new_grade:'',
					goods_type: "",
					website_price: "",
					month_total:''
				},
				initData: {
					cert_name: '',
					cert_no: '',
					mobile: '',
					resp_data: [],
					start_at: '',
					end_at: '',
					orderId: '',
					is_me: '', //是否一致
					online_time: '', //在网时长
					rent_total:''
				},
				court_risk_info_list: [], //法院
				personal_overdue_history_list: [], //历史逾期记录
				hit_risk_tagging: [], //命中风险标记
				dialogVisible: false
			}
		},
		methods: {
			getData() {
				this.initData.cert_name = this.form.cert_name;
				this.initData.cert_no = this.form.cert_no;
				this.initData.mobile = this.form.mobile;
				getRiskData(this.form).then(res => {
					// console.log(res)
					this.initData.resp_data = res.resp_data;
					this.initData.start_at = res.start_at;
					this.initData.end_at = res.end_at;
					this.initData.orderId = res.order_id;
					this.initData.is_me = res.is_me;
					this.initData.online_time = res.online_time;
					this.court_risk_info_list = res.resp_data.court_risk_info_list;
					this.personal_overdue_history_list = Object.keys(res.resp_data.personal_overdue_history
						.datalist).length ? res.resp_data.personal_overdue_history.datalist : [];
					this.hit_risk_tagging = res.resp_data.hit_risk_tagging;
				});
			},
			init() {
				for (let key in this.form) {
					console.log(this.editItem);
					this.form[key] = this.editItem[key].toString() || '';
				}
			}
		},
		watch: {
			dialogVisible(val) {
				if (val) {
					this.init();
					this.getData();
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.type_tip {
		color: #999999;
		line-height: 22px;

		span {
			color: #ff4146;
		}
	}
</style>
